import request from "@/utils/request";

export function fetchList(query) {
  return request({
    url: "/preserve/api/preservePlan/query/page",
    method: "get",
    params: query
  });
}
export function fetchBroadInfo(query) {
  return request({
    url: "/device/api/assetField/query/list",
    method: "get",
    params: query
  });
}
//保存设备信息
export function saveDeviceInfo(query) {
  return request({
    url: "/preserve/api/preservePlan",
    method: "post",
    data: query
  });
}
//更新设备信息
export function updateDeviceInfo(query) {
  return request({
    url: "/preserve/api/preservePlan",
    method: "put",
    data: query
  });
}
//设备详细信息
export function fetchDetailInfo(query) {
  return request({
    url: `/preserve/api/preservePlan/query/${query}`,
    method: "get"
  });
}
//导出
export function exportFile(params) {
  console.log(params);
  return request({
    url: "/device/api/deviceAsset/export",
    method: "post",
    data: params
  });
}
//批量导入
export function importFile() {
  return request({
    url: "/device/api/deviceAsset/import",
    method: "post"
    //data: params
  });
}
//下载批量导入模板

export function downloadTemplete(query) {
  return request({
    url: "/minio/minio/download/excelTemplate",
    method: "post"
    //params: query
  });
}
//删除台账
export function deleteDeviceInfo(query) {
  return request({
    url: "/preserve/api/preservePlan/" + query,
    method: "delete"
    // data: [query]
  });
}
//启用
export function useInfo(id) {
  return request({
    url: `/preserve/api/preservePlan/start/${id}`,
    method: "put"
    //data: query
  });
}
//停用

export function uselessInfo(id) {
  return request({
    url: `/preserve/api/preservePlan/stop/${id}`,
    method: "put"
    //data: query
  });
}
//档案资料
export function fetchHistoryInfo(id) {
  return request({
    url: `/device/api/assetArchive/query/list/${id}`,
    method: "get"
    //data: query
  });
}
//通过主键获取该数据下的额外列表

export function fetchItemsInfo(row) {
  return request({
    url: `/preserve/api/preservePlanItem/query/list`,
    method: "get",
    params: { planId: row.planId }
  });
}
